﻿using System;
using RootMotion.FinalIK;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020000C5 RID: 197
	public class Turret : MonoBehaviour
	{
		// Token: 0x060005F5 RID: 1525 RVA: 0x00037B8C File Offset: 0x00035D8C
		public void Update()
		{
			foreach (Turret.Part part in this.parts)
			{
				part.AimAt(this.target);
			}
		}

		// Token: 0x04000508 RID: 1288
		public Transform target;

		// Token: 0x04000509 RID: 1289
		public Turret.Part[] parts;

		// Token: 0x020000C6 RID: 198
		[Serializable]
		public class Part
		{
			// Token: 0x060005F7 RID: 1527 RVA: 0x00037BC4 File Offset: 0x00035DC4
			public void AimAt(Transform target)
			{
				this.transform.LookAt(target.position, this.transform.up);
				if (this.rotationLimit == null)
				{
					this.rotationLimit = this.transform.GetComponent<RotationLimit>();
					this.rotationLimit.Disable();
				}
				this.rotationLimit.Apply();
			}

			// Token: 0x0400050A RID: 1290
			public Transform transform;

			// Token: 0x0400050B RID: 1291
			public RotationLimit rotationLimit;
		}
	}
}
